-
-
Save mbodo/b107bdfd3160c9cfc76db5c33d6f53b2 to your computer and use it in GitHub Desktop.
Revisions
-
mbodo revised this gist
Mar 11, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -129,4 +129,5 @@ Official: Others: * [ansible-files-layout] (https://leucos.github.io/ansible-files-layout) * [ansible-best-practises] (https://github.com/enginyoyen/ansible-best-practises) * [ansible-local-playbooks] (https://www.tricksofthetrades.net/2017/10/02/ansible-local-playbooks/) * [ansible-vault-digitalocean] (https://www.digitalocean.com/community/tutorials/how-to-use-vault-to-protect-sensitive-ansible-data-on-ubuntu-16-04) -
mbodo revised this gist
Nov 2, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -128,4 +128,5 @@ Official: Others: * [ansible-files-layout] (https://leucos.github.io/ansible-files-layout) * [ansible-best-practises] (https://github.com/enginyoyen/ansible-best-practises) * [ansible-local-playbooks] (https://www.tricksofthetrades.net/2017/10/02/ansible-local-playbooks/) -
mbodo revised this gist
Apr 3, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -127,4 +127,5 @@ Official: * [Ansible - Module] All (http://docs.ansible.com/ansible/list_of_all_modules.html) Others: * [ansible-files-layout] (https://leucos.github.io/ansible-files-layout) * [ansible-best-practises] (https://github.com/enginyoyen/ansible-best-practises) -
mbodo revised this gist
Apr 3, 2017 . 1 changed file with 22 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ e.g ansible-playbook --list-tasks test.yml ``` Output: ``` playbook: test.yml @@ -40,6 +40,27 @@ playbook: test.yml debug TAGS: [subset3] ``` #### List hosts for playbook: ``` ansible-playbook -i <inventory> --list-hosts <playbook>.yml e.g ansible-playbook -i ../development.ini --list-hosts nginx.yml ``` Output: ``` playbook: oracle.yml play #1 (oracle): Install and configure nginx server TAGS: [] pattern: [u'oracle'] hosts (2): vm2 vm1 ``` ### ansible #### Ad-hoc commands: -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 20 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,26 @@ ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-t tag1,tag2] [--list-hos #### Intersect conditions in host limit option ```ansible-playbook -i inventory/ec2.py meta.yml --list-hosts -l "tag_Name_a:&tag_Role_b:&tag_Environment_c"``` #### List task for playbook: ``` ansible-playbook --list-tasks <role>.yml e.g ansible-playbook --list-tasks test.yml ``` Outpt: ``` playbook: test.yml play #1 (default): Test playbook TAGS: [] tasks: debug TAGS: [subset] testrole1/subset2 : Subset2 role task1 TAGS: [subset2] testrole1/subset2 : Subset2 role task2 TAGS: [subset2] debug TAGS: [subset3] ``` ### ansible #### Ad-hoc commands: -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 22 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,14 @@ ## Ansible - Cheatsheet ### ansible-galaxy #### Playbook template init with ansible-galaxy ``` ansible-galaxy init roles/myrole ``` ### ansible-playbook #### Playbook useful switches: ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml @@ -13,18 +17,31 @@ ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-t tag1,tag2] [--list-hos -D show file diffs ``` #### Intersect conditions in host limit option ```ansible-playbook -i inventory/ec2.py meta.yml --list-hosts -l "tag_Name_a:&tag_Role_b:&tag_Environment_c"``` ### ansible #### Ad-hoc commands: ``` ansible -i <inventory> <host/hostgroup> -a <command> e.g ansible -i development.ini vm1 -a "date" ``` Output: ``` 192.XXX.XXX.XXX | SUCCESS | rc=0 >> Sat Apr X XX:46:06 BST 20XX ``` #### Gather facts from a host: ``` ansible -i <inventory> <host> -m setup e.g ansible -i development.ini vm1 -m setup ``` Output: @@ -56,12 +73,11 @@ Output: } ``` ### other #### Search for pattern in all encrypted vault files: ```for f in $(grep -rl '$ANSIBLE_VAULT;1.1'); do echo $f:; ansible-vault view $f | grep <pattern>; done``` Reference links: Official: -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 32 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,11 +20,41 @@ EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ``` #### Gather facts from a host: ``` ansible -m setup -i <inventory> <host> e.g ansible -m setup -i development.ini vm1 ``` Output: ``` "ansible_selinux": { "config_mode": "enforcing", "mode": "enforcing", "policyvers": 28, "status": "enabled", "type": "targeted" }, "ansible_service_mgr": "systemd", ... ``` #### Ping host: ``` ansible -m ping -i <inventory> <host> e.g ansible -m ping -i development.ini vm1 ``` Output: ``` 192.XXX.XXX.XXX | SUCCESS => { "changed": false, "ping": "pong" } ``` #### Search for pattern in all encrypted vault files: ```for f in $(grep -rl '$ANSIBLE_VAULT;1.1'); do echo $f:; ansible-vault view $f | grep <pattern>; done``` -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,6 +23,9 @@ EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ```ansible -m setup -i <inventory> <host>``` #### Ping host: ```ansible -m setup -i <inventory> <host>``` #### Search for pattern in all encrypted vault files: ```for f in $(grep -rl '$ANSIBLE_VAULT;1.1'); do echo $f:; ansible-vault view $f | grep <pattern>; done``` -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,6 +34,7 @@ Reference links: Official: * [Ansible - Docs] (http://docs.ansible.com/ansible/index.html) * [Ansible - Module] Index (http://docs.ansible.com/ansible/modules_by_category.html) * [Ansible - Module] All (http://docs.ansible.com/ansible/list_of_all_modules.html) Others: * [ansible-files-layout] (https://leucos.github.io/ansible-files-layout) -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,8 @@ EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" Reference links: Official: * [Ansible - Docs] (http://docs.ansible.com/ansible/index.html) * [Ansible - Module] Index (http://docs.ansible.com/ansible/modules_by_category.html) Others: * [ansible-files-layout] (https://leucos.github.io/ansible-files-layout) -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,4 +27,12 @@ EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ```for f in $(grep -rl '$ANSIBLE_VAULT;1.1'); do echo $f:; ansible-vault view $f | grep <pattern>; done``` #### Intersect conditions in host limit option ```ansible-playbook -i inventory/ec2.py meta.yml --list-hosts -l "tag_Name_a:&tag_Role_b:&tag_Environment_c"``` Reference links: Official: * Ansible - Docs (http://docs.ansible.com/ansible/index.html) * Ansible - Module Index (http://docs.ansible.com/ansible/modules_by_category.html) * [ansible-files-layout] (https://leucos.github.io/ansible-files-layout) -
mbodo revised this gist
Apr 1, 2017 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,10 @@ ## Ansible - Cheatsheet #### Playbook template init with ansible-galaxy ``` ansible-galaxy init roles/myrole ``` #### Playbook useful switches: ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -
mbodo renamed this gist
Apr 1, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ ## Ansible - Cheatsheet #### Playbook useful switches: ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -
mbodo renamed this gist
Apr 1, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
aleixripoll revised this gist
Feb 23, 2017 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,4 +17,7 @@ EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" #### Search for pattern in all encrypted vault files: ```for f in $(grep -rl '$ANSIBLE_VAULT;1.1'); do echo $f:; ansible-vault view $f | grep <pattern>; done``` #### Intersect conditions in host limit option ```ansible-playbook -i inventory/ec2.py meta.yml --list-hosts -l "tag_Name_a:&tag_Role_b:&tag_Environment_c"``` -
aleixripoll revised this gist
Feb 23, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,5 +15,6 @@ EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" #### Gather facts from a host: ```ansible -m setup -i <inventory> <host>``` #### Search for pattern in all encrypted vault files: ```for f in $(grep -rl '$ANSIBLE_VAULT;1.1'); do echo $f:; ansible-vault view $f | grep <pattern>; done``` -
aleixripoll revised this gist
Feb 23, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,3 +14,6 @@ EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" #### Gather facts from a host: ```ansible -m setup -i <inventory> <host>``` #### Search pattern in encrypted vault file ```for f in $(grep -rl '$ANSIBLE_VAULT;1.1'); do echo $f:; ansible-vault view $f | grep <pattern>; done``` -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #### Playbook useful switches: ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #### ansible-playbook useful switches: ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -C check_mode -D show file diffs -
aleixripoll revised this gist
Feb 6, 2017 . No changes.There are no files selected for viewing
-
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,16 @@ #### ansible-playbook useful switches: ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -C check_mode -D show file diffs ``` #### Ad-hoc commands: ``` ansible -i <inventory> <host/hostgroup> -a <command> EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ``` #### Gather facts from a host: ```ansible -m setup -i <inventory> <host>``` -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #### ansible-playbook useful switches ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml @@ -12,5 +12,5 @@ ansible -i <inventory> <host/hostgroup> -a <command> EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ``` #### Gather facts from a host ```ansible -m setup -i <inventory> <host>``` -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,16 @@ ### ansible-playbook useful switches ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -C check_mode -D show file diffs ``` #### Ad-hoc commands ``` ansible -i <inventory> <host/hostgroup> -a <command> EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ``` ### Gather facts from a host ```ansible -m setup -i <inventory> <host>``` -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,16 @@ ### > ansible-playbook useful switches ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -C check_mode -D show file diffs ``` ### > ad-hoc commands ``` ansible -i <inventory> <host/hostgroup> -a <command> EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ``` ### > gather facts from a host ```ansible -m setup -i <inventory> <host>``` -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,7 @@ ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1, ``` ansible -i <inventory> <host/hostgroup> -a <command> EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ``` ### gather facts from a host > ansible -m setup -i <inventory> <host> -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ### ansible-playbook useful switches ``` ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -C check_mode -D show file diffs -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 2 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,9 @@ ### ansible-playbook useful switches ``` ansible-playbook -C -D -i <inventory> -u <ssh-user> -e <var=value> -t tag1,tag2 --list-hosts -l host1,host2 play.yml -C check_mode -D show file diffs ``` ### ad-hoc commands -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,15 @@ ### ansible-playbook useful switches ``` ansible-playbook -i <inventory> -u <ssh-user> -e <var1=value>,<var2=value> -t tag1,tag2 --list-hosts -l host1,host2 -C check_mode -D show file diffs play.yml ``` ### ad-hoc commands -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,9 +9,5 @@ ansible-playbook [-C] [-D] -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t t ### ad-hoc commands ``` ansible -i <inventory> <host/hostgroup> -a <command> EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date" ``` -
aleixripoll revised this gist
Feb 6, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ### ansible-playbook useful switches ``` ansible-playbook [-C] [-D] -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml -C check_mode -D show file diffs
NewerOlder