https://github.com/sergioarmgpl/ansible-intro
https://github.com/sergioarmgpl/ansible-intro
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sergioarmgpl/ansible-intro
- Owner: sergioarmgpl
- License: mit
- Created: 2020-04-09T04:38:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-07T17:20:40.000Z (almost 5 years ago)
- Last Synced: 2024-12-29T21:12:27.294Z (5 months ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ANSIBLE
yum install epel-release
yum install ansible
yum install git
useradd -m ansible
useradd -m ansible
ansible ALL=(ALL) NOPASSWD: ALL
ansible server1 -m setup | less
ansible server1 -m ping
ansible server1 -b -m apt -a "update_cache=true name=apache2 state=present"
ansible server1 -b -m service -a "name=apache2 state=started"
ansible server1 -b -m service -a "name=apache2 state=stopped"
sudo su - ansible
ssh-keygen
ssh-copy-id server.dominio.tld
ansible-playbook -i inv web.yml
ansible-playbook -i inv web.yml --check #dry-run
## variables
ansible-playbook -i inv web.yml -e "var1=value var2=value"
locate in file {{ var1 }}
ansible-playbook -i inv web.yml -e "mensaje=\"use variables\""
{{mensaje}} Este lo use en el servidor
ansible server1 -m setup -a filter=\*palabra\*
tasks:
- debug:
var: variable
register al final de un task se puede imprimir
-debug:
msg: "xyz {{ variable }}"
handlers