Skip to content

Instantly share code, notes, and snippets.

View gist:10a8f99e3f5b97b137e27948a7e64f79
PLAY [local] ***********************************************************************************************************************************
TASK [ec2_vpc_net_info] ************************************************************************************************************************
[WARNING]: Platform linux on host localhost is using the discovered Python interpreter at /usr/bin/python, but future installation of another
Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more
information.
ok: [localhost]
View gist:5f34fbf3ebb4d8b0f770c069b1c30374
---
- hosts: local
connection: local
gather_facts: false
tasks:
- ec2_vpc_net_info:
region: eu-central-1
filters:
"tag:environment": production # "{{ vardata.environment }}"
View gist:ba2c971051d963e8262b1909f57d0a0c
[ansible@ip-192-168-1-229 usersGroups]$ ansible-playbook test1.yml -K
BECOME password:
PLAY [test_servers] *************************************************************************************************************************************************
TASK [create group] *************************************************************************************************************************************************
[WARNING]: Platform linux on host 192.168.2.224 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter
could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
fatal: [192.168.2.224]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": true, "cmd": ["groupadd", "ansible_grp"], "delta": "0:00:00.003341", "end": "2020-01-22 09:02:16.304129", "msg": "non-zero return code", "rc": 9, "start": "2020-01-22 09:02:16.300788", "st
View .yml
---
- hosts: test_servers
connection: local
gather_facts: false
become: yes
remote_user: root
tasks:
- name: create group
View gist:670d3c0e5cc96d7b0082cf340f053198
[ansible@ip-192-168-1-229 usersGroups]$ ansible-playbook usersGroups.yml -K
BECOME password:
PLAY [test_servers] *************************************************************************************************************************************************
TASK [Ensure group "ansible" exists] ********************************************************************************************************************************
[WARNING]: Platform linux on host 192.168.2.224 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter
could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
ok: [192.168.2.224]
View userGroups.yml
---
- hosts: test_servers
connection: local
gather_facts: false
tasks:
- name: Ensure group "ansible" exists
become: yes
become_user: root
group:
View .yml
---
- hosts: test_servers
connection: local
gather_facts: false
tasks:
- name: Ensure group "ansible" exists
become: yes
become_user: root
group: