aboutsummaryrefslogtreecommitdiff
path: root/example.yml
blob: 7f7e36effeeeaab5953bac440cc5a36c22bbfed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
- hosts: localhost
  tasks:
  - name: Create a host in Foreman
    foremanhost:
      name: foobar
      hostgroup: Medium/jenkins/blue
      state: present
      json: "{{ lookup('template', 'example.json') }}"
      api_user: foreman
      api_password: changeme
      api_url: https://127.0.0.1
      ssl_verify: False
    register: result

  - debug:
      msg: Got "{{ result }}"

  - name: Delete a host in Foreman
    foremanhost:
      name: foobar.example.com
      state: absent
      api_user: foreman
      api_password: changeme
      api_url: https://127.0.0.1
      ssl_verify: False