LoginSignup
1
0

More than 3 years have passed since last update.

Install the latest Ansible v2.9.2 without `id_rsa.pub` , `authorized_keys`

Last updated at Posted at 2020-01-15

banner-ansible.png

Install the latest Ansible version 2.9.2
How to use without id_rsa.pub , authorized_keys 🙈

Test environment

  • Ubuntu 18.04
  • Ansible 2.9.2

Install

$ apt-get update
$ apt-get install software-properties-common
$ apt-add-repository --yes --update ppa:ansible/ansible
$ apt-get install ansible
$ ansible --version
ansible 2.9.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Nov  7 2019, 10:07:09) [GCC 7.4.0]

Modify Ansible Configuration File

Modify both /etc/ansible/ansible.cfg and /etc/ansible/hosts Ref Link

$ vi /etc/ansible/ansible.cfg
[defaults]
host_key_checking = False
[ssh_connection]
ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
control_path = /dev/shm/cp%%h-%%p-%%r

$ vi /etc/ansible/hosts
[child]
182.252.133.71
182.252.133.72

[child:vars]
ansible_user=root
ansible_password=Password1!

Run

Check the operation with the default ping command of ad-hoc.
Once ping and pong are confirmed, you're done! 👌

$ ansible child -m ping -i /etc/ansible/hosts
182.252.133.72 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
182.252.133.71 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0