aboutsummaryrefslogtreecommitdiff
path: root/host.yml
blob: f859cd3be1821f0154fbed3424458fa7cade4b3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
- hosts: localhost
  gather_facts: false
  vars:

  tasks:
    - name: Block for localhost run
      block:
        - ansible.builtin.pause:
            prompt: "Warning - no hosts were given, this will run on localhost - hit enter to continue or ctrl-c to cancel"

        - name: Add localhost to all group if no hosts are defined
          ansible.builtin.add_host:
            name: "localhost"
            ansible_connection: "local"
      when: groups['all'] | length == 0


- hosts: all
  become: true
  tasks:
    - ansible.builtin.import_role:
        name: "host"