- name: add search path to /etc/resolv.conf
lineinfile:
dest: "/etc/resolv.conf"
backrefs: True
state: present
insertbefore: ^nameserver
regexp: '(^\s*search(\s+(?!\b{{ item }}\b)[\w\.]+)*)\s*$'
line: '\1 {{ item }}'
with_items: "{{ searchpath }}"
About regex_replace
var1: ""{{ var2 | regex_replace ('ABC-(\\d.\\d+)', '\\1) }}"
ansible-vault encrypt_string password123 --ask-vault-pass
- name: revert to a snapshot
vmware_guest_snapshot:
datacenter:
hostname: this is vcenter host name
username:
password:
name: this is vm name
state: revert
snapshot_name:
delegate_to: localhost
- name: power on vm
vmware_guest:
datacenter:
hostname: this is vcenter host name
username:
password:
name: this is vm name
state: poweredon
delegate_to: localhost
- name: Wait for host to come back
local_action:
module: wait_for
host="{{ inventory_hostname }}"
port=22
delay=30
timeout=300
No comments:
Post a Comment