0

I have:

  • a ansilbe tower set up (aws EC2).
  • a ubuntu server (aws ec2).

I have created a inventory group of main in tower and am attempting to add the ubuntu server as a host.

---
- name: ubuntu
  add_host:
    name: "192.168.1.1"
    groups: main

based on the documentation I have written the above for the variables section of the create hosts interface however i get the message invalid yaml.

any advice on where i have gone wrong?

ndmeiri
  • 4,979
  • 12
  • 37
  • 45
  • 2
    You don't add a host to the Tower inventory with `add_host` but with the [`tower_host` module](https://docs.ansible.com/ansible/2.5/modules/tower_host_module.html). But then it won't work easy with adding the host to the group as the `tower`-modules seem not to have matured yet -- there was [a similar question earlier today](https://stackoverflow.com/q/51472573/2947502). – techraf Jul 23 '18 at 15:00

1 Answers1

0

Iam not using Ansible tower, however putting my thought to see if it helps

With minor changes the above code worked for me

---
- hosts: localhost
  tasks:
    - name: ubuntu
      add_host:
           name: "192.168.3.104"
           groups: main

Hope that helps

Sudhakar MNSR
  • 594
  • 1
  • 3
  • 17