Setting Ansible pull for the first time.

( is a bit
confusing to need to run a playbook that will install ansible and install
the cron for you and the doc doesn't really say that you need the playbook
to be local.yml and that you need to run it with --conection=local for the
initial setup and then you don't need anymore that playbook and some other
details).

Which file are you referring to, the online docs or the example playbook file?

Anyhow the question that I have is that I get this error every time that I
update the local.yml in the git repo :

Sep 11 06:21:09 ubuntu-oneiric ansible-apt: Invoked with pkg=nginx
state=removed
cmd=ansible all -c local -m git -a
"repo=git://github.com/jamengual/ansible-vagrant.git
dest=/var/lib/ansible/local version=HEAD"
localhost | FAILED >> {
    "failed": true,
    "msg": "fatal: destination path '/var/lib/ansible/local' already exists
and is not an empty directory.\n"
}

What version of ansible are you using? I do not see this string
"(already exists and)" in 0.8 or the latest 0.7.

( is a bit
confusing to need to run a playbook that will install ansible and install
the cron for you and the doc doesn’t really say that you need the playbook
to be local.yml and that you need to run it with --conection=local for the
initial setup and then you don’t need anymore that playbook and some other
details).

Which file are you referring to, the online docs or the example playbook file?

The online docs do not say anything about that.

Anyhow the question that I have is that I get this error every time that I
update the local.yml in the git repo :

Sep 11 06:21:09 ubuntu-oneiric ansible-apt: Invoked with pkg=nginx
state=removed
cmd=ansible all -c local -m git -a
“repo=git://github.com/jamengual/ansible-vagrant.git
dest=/var/lib/ansible/local version=HEAD”
localhost | FAILED >> {
“failed”: true,
“msg”: “fatal: destination path ‘/var/lib/ansible/local’ already exists
and is not an empty directory.\n”
}

What version of ansible are you using? I do not see this string
“(already exists and)” in 0.8 or the latest 0.7.

Good question, :
vagrant@ubuntu-oneiric:~$ ansible --version
ansible 0.7

vagrant@ubuntu-oneiric:~$ ansible-playbook --version
ansible-playbook 0.7

But there is no such option on ansible-pull command.

Thanks for the help.

Ah, this error message is coming from the git binary.

Looks like we have some fixing to do with the git module to make it
run repeatably, please make sure there is a bug filed on github.

It's not specific to ansible-pull, just the git module. Maybe it's
not forcing by default or isn't updating and is trying to clone. Need
to look.

Though others should be using the git module, which makes me a bit curious.

So I guess that I shout not worry about it.

No I have some other questions :

I’m using the apt module and I see in the docs this :

apt pkg=foo update-cache=yes
apt pkg=foo state=removed
apt pkg=foo state=installed
apt pkg=foo=1.00 state=installed
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes
apt pkg=openjdk-6-jdk state=latest install-recommends=no

But above of those examples it says :

state | no | present | ‘absent’, ‘present’, or ‘latest’.
|

  • | - | - | - |

so I should asume that the apt module has the states : absent, present, latest, removed, installed ?

I try with adding nginx and then remove it and it installed this :

sudo dpkg -l|grep nginx
ii nginx 1.1.19-1 small, but very powerful and efficient web server and mail proxy
ii nginx-common 1.1.19-1 small, but very powerful and efficient web server (common files)
ii nginx-full

But when I used the removed it just removed the nginx package so I guess that I need another option to remove all toghether ?

and with the absent option that package was marked as “to be removed” so it didn’t actually remove it.

Sorry, this could more a question for “Apt 101” but I don’t know if it’s related to the apt module.

Thanks Again.

Bug filed to track this:

https://github.com/ansible/ansible/issues/1034

If someone wants to beat me to it, that would be awesome :slight_smile:

I'm using the apt module and I see in the docs this :

apt pkg=foo update-cache=yes
apt pkg=foo state=removed
apt pkg=foo state=installed
apt pkg=foo=1.00 state=installed
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes
apt pkg=openjdk-6-jdk state=latest install-recommends=no

But above of those examples it says :

statenopresent‘absent’, ‘present’, or ‘latest’.
so I should asume that the apt module has the states : absent, present,
latest, removed, installed ?

Yes.

'absent' is the same as 'removed', 'present' is the same as
'installed'

I try with adding nginx and then remove it and it installed this :

sudo dpkg -l|grep nginx
ii nginx 1.1.19-1 small, but
very powerful and efficient web server and mail proxy
ii nginx-common 1.1.19-1 small, but
very powerful and efficient web server (common files)
ii nginx-full

But when I used the removed it just removed the nginx package so I guess
that I need another option to remove all toghether ?

IMHO, this is really the way it should work, because you never know if
a user has come to rely on a package that was installed as a
dependency. So you should then specify that all three packages are
removed.

Most of the time, with config management systems, you are not
specifying removal, though since Ansible has uses as an add hoc tool,
it can be useful.

"with_items" in a playbook is helpful for this, or if running from /
usr/bin/ansible, you can just do this:

ansible groupname -m apt -a "name=nginx,nginx-common,nginx-full
state=removed"

And it will do it all in one hop.

Actually this sounds like the deps on the package are kind of weird.

Someone with apt-foo please check it out and make sure we're not doing
something wrong, please :slight_smile:

Disclaimer: I am mostly a CentOS guy lately.

Thanks for that too!!! maybe should be added to the doc for clarification ?

And for the propert steps of setting the pull nodes this is what I understand :

1.- setup git repo with local.yml playbook with the needed tasks
2.- install ansible in the node
3.- download and modify ansible_pull.yml ( change repo url and maybe sudo: True etc).
4.- Run ansible-playbook using_the_example_modified_paybook.yml

and that will be all ?

Thanks.

You've got it.

You can do step 2 with ansible if you want :slight_smile:

Wait, how do I install ansible with ansible ? you got me confused…

Use the yum or apt resource with the proper repos configured.

Ohh ok, that is what I did, I just used the repos from the docs.

Thanks a lot for the help.