Posts

Showing posts from March, 2016
Templates The following functions and macros can be used within templates. These are guaranteed to work via the safemode rendering, to ensure a template can do nothing harmful. With safemode disabled other macros may work, but are not supported at this time. To enable safemode, set "safemode_render" to "true" in Settings -> Foreman settings. Safemode rendering prevents templates from reading and writing files on the file system or modifying application data within foreman. Accessing Templates There are two ways to render a template, based on a single host, or based on a Hostgroup. The host or hostgroup provides all the details with which to render the template. Host-based Rendering Only a single template of each type may be rendered for a system. Foreman determines which template to use following these rules: 1. Only the templates of the appropriate kind and associated with the hosts operating system are considered 2. If a

Check disk free with ansible

To check the disk free with ansible you can run the following command To get all the hosts execute: # ansible -m command -a "df -h" all To get some group the hosts  ansible -m command -a "df -h" -i <hosts file>

How to run a playbook as normal user in the remote machine

 For this example you need to create the following directories as best practices For example root  |  ---- group_vars  |  -----roles  |          |  |          ----common  |-- site.yml  |-- hosts Create the root directory in this example named ansible #mkdir  ansible create the group_var and roles directories #mkdir group_vars #mkdir roles Create the files site.yml and hosts # touch site.yml # touch hosts Too create the common directory change to the directory roles and execute the following command ansible-galaxy init common this command create the standard infrastructure directories for use with ansible playbook For this example i would like to put the sudoers files in some machines to get this result we need to go into the common directory and there go into the tasks directory you are going to find a file named main.yml open it and copy the following remember start the file with 3 --- this indicate the beginning of the YAML file --- - name: Sudo