On Thursday, June 2, 2016 at 2:02:41 PM UTC-5, Johannes Kastl wrote:
>
> Hi there, 
>
> On 02.06.16 17:35 Tom Hanson wrote: 
>
> > I am fairly new working with ansible and am operating some playbooks 
> that 
> > were built by someone else who is gone. The current playbooks will set 
> up a 
> > new server and work fine. It installs several standard packages and will 
> > change to all SSH logins , no root login. The first time I will put the 
> >   ansible_ssh_user=root ansible_ssh_pass= xxxxx   on the inventory line. 
>
> Keeping that in a ansible-vault encrypted file is the better option, 
> but first things first. 
>
> > After that root access no longer works. 
>
> I guess your playbook changes the sshd's settings, right? 
>
> > the problem is when I need to run a playbook to update the server. 
>
> The same playbook run again? Or another playbook? Could you share the 
> parts of the playbook that show the errors? 
>
> > I get a 
> > failure that looks like this : 
> > 
> > 
> > *ipaddress*> ESTABLISH CONNECTION FOR USER: *myusername* 
> > <*ipaddress*> REMOTE_MODULE setup 
> > <*ipaddress*> EXEC sshpass -d7 ssh -C -tt -v -o ControlMaster=auto -o 
> > ControlPersist=60s -o 
> > ControlPath="/home/nnnn/.ansible/cp/ansible-ssh-%h-%p-%r" -o 
> > StrictHostKeyChecking=no -o GSSAPIAuthentication=no -o 
> > PubkeyAuthentication=no -o ConnectTimeout=10 *ipaddress* /bin/sh -c 
> 'mkdir 
> > -p $HOME/.ansible/tmp/ansible-tmp-1464038963.41-214242419831580 && chmod 
> > a+rx $HOME/.ansible/tmp/ansible-tmp-1464038963.41-214242419831580 && 
> echo 
> > $HOME/.ansible/tmp/ansible-tmp-1464038963.41-214242419831580' 
> > fatal: [server] => SSH Error: Permission denied (publickey). 
> >     while connecting to *ipaddress*:22 
> > 
>
> Can you login as the destination user if you do it manually? Do you 
> have the right ssh keys on your machine? 
>
> Johannes 
>
>

####The same playbook run again? Or another playbook? Could you share the
parts of the playbook that show the errors?

different playbook - this is one to just update the hosts file, 
    
ansible-playbook -vvv  update_hosts.yml -i inventory/inventory
file update_hosts.yml    
    ---
- hosts: *servername*
  sudo: yes
  roles:
    - hosts
Roles folder

hosts folder
default folder

file - main.yml
---
host_vars_etc_hosts: ""
group_vars_etc_hosts: ""

tasks folder 
file main.yml
---
- name: configure /etc/hosts
  template:
    src: "hosts.j2"
    dest: "/etc/hosts"
    owner: root
    group: root
    mode: 0644
    backup: yes
templates folder
hosts.j2 file (the actual hosts file to be copied over) 

####Can you login as the destination user if you do it manually? Do you
have the right ssh keys on your machine?
yes, My key works on the servers after they are configured 

Thanks-  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2d5ea8ff-6e54-4432-a762-1fd942eee760%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to