summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/hostname/tasks/check_mode.yml
blob: e25df97b61d87fd95bbb00bfb6103bef6da2cd8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# These are less useful (check_mode only) but run even in containers
- block:
    - name: Get current hostname
      command: hostname
      register: original

    - name: Change hostname (check_mode)
      hostname:
        name: crocodile.ansible.test.doesthiswork.net.example.com
      check_mode: true
      register: hn

    - name: Get current hostname again
      command: hostname
      register: after_hn

    - assert:
        that:
          - hn is changed
          - original.stdout == after_hn.stdout