Ansible error while ansible -m ping all

0 votes

I've installed ansible on ubuntu and when I execute this:

ansible -m ping all

I get the following error:

[ERROR]: Unable to set correct type for configuration entry for DEFAULT_LOCAL_TMP: Unable to
create local directories(/home/myuser/.ansible/tmp): [Errno 13] Permission denied:
'/home/myuser/.ansible/tmp'

mean.yml

- hosts: nodes
  become: yes
  become_method: sudo
  vars:
    #variable needed during node installation
    var_node: /tmp
  
  roles:
    - prerequisites
    - mongodb
    - nodejs

prerequisites.yml

- name: Install git
  apt:
    name: git
    state: present
    update_cache: yes

mongodb.yml

- name: MongoDB - Import public key
  apt_key:
    keyserver: hkp://keyserver.ubuntu.com:80
    id: EA312927

- name: MongoDB - Add repository
  apt_repository:
    filename: '/etc/apt/sources.list.d/mongodb-org-3.2.list'
    repo: 'deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse'
    state: present
    update_cache: yes

- name: MongoDB - Install MongoDB
  apt:
    name: mongodb-org
    state: present
    update_cache: yes

- name: MongoDB - Running state
  service:
    name: mongod
    state: started

nodejs.yml

- name: Node.js - Get script
  get_url:
    url: "http://deb.nodesource.com/setup_6.x"
    dest: "{{ var_node }}/nodejs.sh"

- name: Node.js - Set execution permission to script
  file:
    path: "{{ var_node }}/nodejs.sh"
    mode: "u+x"

- name: Node.js - Execute installation script
  shell: "{{ var_node }}/nodejs.sh"

- name: Node.js - Remove installation script
  file:
    path: "{{ var_node}}/nodejs.sh"
    state: absent

- name: Node.js - Install Node.js
  apt: name={{ item }} state=present update_cache=yes
  with_items:
    - build-essential
    - nodejs

- name: Node.js - Install bower and gulp globally
  npm: name={{ item }} state=present global=yes
  with_items:
    - bower
    - gulp
Mar 15, 2019 in Ansible by Kalgi

edited Mar 16, 2019 by Kalgi 3,316 views

2 answers to this question.

0 votes

check package were installed and updated properly 

apt-get update && apt-get install -y iputils-ping
answered Mar 16, 2019 by anonymous
Packages are installed perfectly
0 votes

It looks like ansible may be installed as a different user. Have you tried logging in as root and then running it?

answered Mar 18, 2019 by Vince

Related Questions In Ansible

0 votes
1 answer
+1 vote
3 answers
0 votes
1 answer

Errors when executing - ansible -m ping all - kubespray

Hey @Ananya, make sure of these following ...READ MORE

answered Jan 24, 2019 in Ansible by Yesha
5,338 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Playbook to install and start nginx on ubuntu

Write your playbook like this: --- - hosts: droplets ...READ MORE

answered Mar 15, 2019 in Ansible by Deep
11,924 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,034 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP