mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-25 12:54:23 +00:00
chore(ansible): add listing commands to the set
This commit is contained in:
@@ -40,7 +40,7 @@ pip3 install --user 'ansible'
|
||||
brew install 'ansible' 'sshpass' # darwin
|
||||
sudo pamac install 'ansible' 'sshpass' # manjaro linux
|
||||
|
||||
# Generate an example configuration file with all entries disabled.
|
||||
# Generate example configuration files with entries disabled.
|
||||
ansible-config init --disabled > 'ansible.cfg'
|
||||
ansible-config init --disabled -t 'all' > 'ansible.cfg'
|
||||
|
||||
@@ -49,6 +49,11 @@ ansible -i 'path/to/hosts/file' -m 'setup' all
|
||||
ansible -i 'host1,hostN,' -m 'setup' 'host1' -u 'remote-user'
|
||||
ansible -i 'localhost,' -c 'local' -km 'setup' 'localhost'
|
||||
|
||||
# List hosts.
|
||||
ansible-inventory -i 'inventory' --list
|
||||
ansible-playbook -i 'inventory' 'playbook.yml' --list-hosts
|
||||
ansible -i 'inventory' all --list-hosts
|
||||
|
||||
# Check the syntax of a playbook.
|
||||
# This will *not* execute the plays inside it.
|
||||
ansible-playbook 'path/to/playbook.yml' --syntax-check
|
||||
@@ -56,7 +61,7 @@ ansible-playbook 'path/to/playbook.yml' --syntax-check
|
||||
# Execute playbooks.
|
||||
ansible-playbook 'path/to/playbook.yml' -i 'hosts.list'
|
||||
ansible-playbook … -i 'host1,host2,hostN,' -l 'hosts,list'
|
||||
ansible-playbook … -i 'host1,host2,other,' -l 'hosts-pattern'
|
||||
ansible-playbook … -i 'host1,host2,other,' -l 'hosts-pattern' --step
|
||||
|
||||
# Show what changes (with details) a play would apply to the local machine.
|
||||
ansible-playbook 'path/to/playbook.yml' -i 'localhost,' -c 'local' -vvC
|
||||
|
||||
30
snippets/ansible.sh
Normal file
30
snippets/ansible.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Generate example configuration files with entries disabled.
|
||||
ansible-config init --disabled > 'ansible.cfg'
|
||||
ansible-config init --disabled -t 'all' > 'ansible.cfg'
|
||||
|
||||
# List hosts.
|
||||
ansible-inventory -i 'aws_ec2.yml' --list
|
||||
ansible-playbook -i 'self-hosting.yml' 'gitlab.yml' --list-hosts
|
||||
ansible -i 'webservers.yml' all --list-hosts
|
||||
|
||||
# Show hosts' ansible facts.
|
||||
ansible -i 'inventory.yml' -m 'setup' all
|
||||
ansible -i '192.168.1.34,gitlab.lan,' -m 'setup' 'gitlab.lan' -u 'admin'
|
||||
ansible -i 'localhost,' -c 'local' -km 'setup' 'localhost'
|
||||
|
||||
# List tasks what would be executed.
|
||||
ansible-playbook 'gitlab.yml' --list-tasks
|
||||
ansible-playbook 'gitlab.yml' --list-tasks --tags 'configuration,packages'
|
||||
ansible-playbook 'gitlab.yml' --list-tasks --skip-tags 'system,user'
|
||||
|
||||
# Create new roles.
|
||||
ansible-galaxy init 'gitlab'
|
||||
ansible-galaxy role init --type 'container' --init-path 'gitlab' 'name'
|
||||
|
||||
# Apply changes.
|
||||
ansible-playbook \
|
||||
-i 'aws_ec2.yml' -e 'ansible_aws_ssm_plugin=/usr/local/sessionmanagerplugin/bin/session-manager-plugin' \
|
||||
-D --step \
|
||||
'gitlab.yml'
|
||||
Reference in New Issue
Block a user