Ansible

Courses

Links

Syntax

the default ansible host file

cat /etc/ansible/hosts
# This is the default ansible 'hosts' file.

adding an user

ansible-playbook playbooks/server/sftp.yml —tags=add_groupname_users --limit=int-sftp

removing user

ansible-playbook playbooks/server/sftp.yml --tags=remove_user --limit=int-sftp -e remove_user=giuseppeusername

run in verbose mode -vvv OR -vvvvv

ansible-playbook playbooks/server/all.yml --tags=ping --limit=myserver.mydomain.com -vvv
Using /Users/giuseppe/.ansible.cfg as config file

PLAYBOOK: all.yml **************************************************************
1 plays in playbooks/server/all.yml

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
<myserver.mydomain.com> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<myserver.mydomain.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/Users/giuseppe/.ssh/2016-dq.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/Users/giuseppe/.ansible/cp/ansible-ssh-%h-%p-%r myserver.mydomain.com '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1466780547.9-266501703677044 `" && echo ansible-tmp-1466780547.9-266501703677044="` echo $HOME/.ansible/tmp/ansible-tmp-1466780547.9-266501703677044 `" )'"'"''

change the connectio on inventory file

myserver.mydomain.com ansible_ssh_user=ubuntu ansible_ssh_private_key_file=~/.ssh/2016-dq.pem
Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License