Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Abhishek_Kumar1
Collaborator
Jump to solution

Automation with Ansible

Hi -

 

I am trying to create a host using ansible script. while trying to run the script. i am getting below error.

I have a R80.40 Mgmt deployed in GCP.

fatal: [35.201.154.110]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 35.201.154.110 closed.\r\n", "module_stdout": "admin is not in the sudoers file. This incident will be reported.\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

 

Regards

Abhishek

0 Kudos
1 Solution

Accepted Solutions
Abhishek_Kumar1
Collaborator
here is my play book.



- name: check reachable hosts
hosts: all
vars:
ansible_python_interpreter: /usr/bin/python3
remote_user: admin
gather_facts: no
tasks:
- command: ping -c1 {{ inventory_hostname }}
delegate_to: localhost
register: ping_result

- name: add-host
cp_mgmt_host:
ip_address: 192.0.2.1
name: New Host 1
state: present
become: yes



View solution in original post

0 Kudos
3 Replies
masher
Employee
Employee

Without seeing your playbook, I'm curious why ansible is having the admin user attempt to use sudo. When logging into Gaia as an administrative user, the use of sudo is not required.

 

fatal: [...]: FAILED! => {
"changed": false,
"module_stderr":
"Shared connection to ... closed.\r\n",
"module_stdout": "admin is not in the sudoers file. This incident will be reported.\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}

 

 

 

0 Kudos
Abhishek_Kumar1
Collaborator

here is my play book.

 

- name: check reachable hosts
hosts: all
vars:
ansible_python_interpreter: /usr/bin/python3
remote_user: admin
gather_facts: no
tasks:
- command: ping -c1 {{ inventory_hostname }}
delegate_to: localhost
register: ping_result

- name: add-host
cp_mgmt_host:
ip_address: 192.0.2.1
name: New Host 1
state: present
become: yes

0 Kudos
Abhishek_Kumar1
Collaborator
here is my play book.



- name: check reachable hosts
hosts: all
vars:
ansible_python_interpreter: /usr/bin/python3
remote_user: admin
gather_facts: no
tasks:
- command: ping -c1 {{ inventory_hostname }}
delegate_to: localhost
register: ping_result

- name: add-host
cp_mgmt_host:
ip_address: 192.0.2.1
name: New Host 1
state: present
become: yes



0 Kudos
Upcoming Events

    CheckMates Events