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 in Ansible by Kalgi

edited Mar 15 by Kalgi 305 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 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 by Vince

Related Questions In Ansible

0 votes
1 answer
0 votes
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 23 in Ansible by Yesha
505 views
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
212 views