From the course: Ansible Essential Training
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Registering discovered state - Ansible Tutorial
From the course: Ansible Essential Training
Registering discovered state
- [Instructor] So it is a fact, and yes, that is an intentional pun regarding Ansible facts, it's a fact that we love idempotence with Ansible. It solves so many of our headaches from a management through scripts approach that we might take but what about commands and modules that we don't have idempotent support with? Well, as I'm going to show you right now at the command line, there's great news. There are various approaches we can take to build idempotence into the playbooks. The simplest way to do this is to build state information into these commands. Let's take a look at that. So let me go ahead and cat our register_state.yml file and let's scroll up to the top of this file. We can see we are working against the webservers, and as far as variables go, we set one that is a target variable, and notice, we're giving a path. It's going to be /temp and then idempotent.txt. Notice under the tasks area, we do a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.