I just checked the ansible version, it was quite old, version 2.2

I updated, now it is version 2.6
The earlier problem is resolved, though I have another problem now.
When running the playbook below, it throws error. I am running in *vagrant*.

- name: ensure Nginx is installed via the system package
  apt: name=nginx state=present update_cache=yes
  sudo: yes
ansible-playbook -i hosts site.yml --tags acceptance

....
TASK [common : ensure Nginx is installed via the system package] 
***********************************************************************************************
fatal: [195.121.71.148]: FAILED! => {"changed": false, "msg": "Failed to 
lock apt for exclusive operation"}
....

Does this have to do with the user?

In my site.yml I have the following:

- name: Configure acceptance server
  hosts: acceptance
  user: vagrant
  roles:
    - common
  tags: acceptance




Op dinsdag 28 augustus 2018 15:12:40 UTC+2 schreef [email protected]:
>
> Hi,
>  
> I am experiencing something similar to this issue Ansible group_vars from 
> inventory don't support repeated hosts 
> <https://github.com/ansible/ansible/issues/17243>.
>
> My main playbook is:
>
> *site.yml*
>
> - name: Configure acceptance server
>   hosts: acceptance
>   roles:
>     - common
>   tags: acceptance
>
>
> - name: Configure production server
>   hosts: production
>   roles:
>     - common
>   tags: production
>
>
> *hosts*
> [acceptance]
> 127.0.0.1 ansible_connection=local
>
> [production]
> 127.0.0.2 ansible_connection=local
>
> In the group_vars I have the following files:
>
> *acceptance*
> # Application
> app_name: snow_proxy
> cert_name: vcpe-le-snow-proxy-acc
>
>
> # Web Server
> ## deploy_ssl true for HTTPS, false for only HTTP
> deploy_ssl: true
> ## local directory SSL certificates should be located here
> ssl_certs_dir: /home/mid/certs
>
>
> *production*
> # Application
> app_name: snow_proxy
> cert_name: vcpe-le-snow-proxy-acc
>
>
> # Web Server
> ## deploy_ssl true for HTTPS, false for only HTTP
> deploy_ssl: true
> ## local directory SSL certificates should be located here
> ssl_certs_dir: /home/mid/prod/certs
>
> When running the playbook I expect the correct set of variables will be 
> loaded depending on the tag, but in both cases it seems the group_vars are 
> overriding each other because the same host is repeated in both groups.
>
> ansible-playbook -i hosts site.yml --tags acceptance
>
> ....
> Unable to find '/home/mid*/prod/certs/*vcpe-le-snow-proxy-acc.crt' in 
> expected paths.
> ....
>
>
> ansible-playbook -i hosts site.yml --tags production
>
> ....
> Unable to find '/home/mid*/prod/certs/*vcpe-le-snow-proxy-acc.crt' in 
> expected paths.
> ....
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c9287f25-152c-4fdf-9a76-566ee263a851%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to