I`m trying to launch one playbook:
it should look like this
tasks:
- name: ensure update
apt:update_cache=yes
- apt:upgrade=full
You cannot have multiple tasks per task, name is optional but - is not
as it indicates when the 'next task' starts
Ok, now I have another code in playbook
Hi,
tasks should have more spaces, it should be aligned to user, sudo, etc. keywords:
theres an intro to yaml syntax here. http://docs.ansible.com/ansible/YAMLSyntax.html
be carefull cutting and pasting from groups because things can get reformatted. heres an example with the code highlighting. i hope it comes out ok. also, you can put multiple variables in a single module call like this.
`
Im trying to run your example, but I have a message of error again. Now this is another position. I thougth there could be a problem with spaces, but changes doesn
t work too.
ERROR: Syntax Error while loading YAML script, test1.yml
Note: The error may actually appear before this position: line 10, column 1
apt:update_cache=yes upgrade=full cache_valid_time=3600
^
you need a space after :
apt: update_cache=yes upgrade=full cache_valid_time=3600
Thank you. Now playbook doesn`t have syntax errors, but I have a permission error.
`
PLAY [group1] *****************************************************************
GATHERING FACTS ***************************************************************
<172.17.251.236> ESTABLISH CONNECTION FOR USER: user1
<172.17.251.236> REMOTE_MODULE setup
<172.17.251.236> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user1 -o ConnectTimeout=10 172.17.251.236 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1444203780.43-167481022998325 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1444203780.43-167481022998325 && echo $HOME/.ansible/tmp/ansible-tmp-1444203780.43-167481022998325’
fatal: [172.17.251.236] => SSH Error: Permission denied (publickey,password).
while connecting to 172.17.251.236:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
TASK: [ensure update] *********************************************************
FATAL: no hosts matched or all hosts have already failed – aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/test1.retry
172.17.251.236 : ok=0 changed=0 unreachable=1 failed=0
`
I guess there might ba problem with SSH key and I have to make it and save in directory /root/.ansible/cp/. But SSH agent can`t open a connection to my authentication agent. Do you know, where does the trouble lie?