• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to create Ansible Inclusion In Ansible on Centos7

  • 00:54 lsb_release -d
  • 01:02 ls
  • 01:07 cd ansible_inclusion/
  • 01:11 ls
  • 01:24 vi setup.yml
  • 02:00 vi tasks.yml
  • 02:23 ansible-playbook setup.yml --syntax-check
  • 02:36 ansible-playbook setup.yml
  • 02:50 vi packages.yml
  • 03:02 vi installpkg.yml
  • 03:09 ansible-playbook installpkg.yml --syntax-check
  • 03:26 ansible-playbook installpkg.yml
{{postValue.id}}

To create Ansible Inclusion In Ansible on Centos7

Introduction:

Ansible is an agentless computerization tool that can install on a control node. Using the control node, Ansible runs machines and other devices remotely. (by default, over the SSH protocol.

Steps:

Check the Os version by using below command:

[root@linuxhelp ~]# lsb_release -d
Description:	CentOS Linux release 7.6.1810 (Core)  

List the directory:

[root@linuxhelp ~]# ls
anaconda-ks.cfg  ansible_inclusion  hello.txt  original-ks.cfg

Switch to ansible inclusion directory:

[root@linuxhelp ~]# cd ansible_inclusion/

List the directory:

[root@linuxhelp ansible_inclusion]# ls
ansible.cfg  hosts  setup.yml  tasks.yml

Open the setup.yml file:

[root@linuxhelp ansible_inclusion]# vi setup.yml

snap1

Open the tasks.yml file:

[root@linuxhelp ansible_inclusion]# vi tasks.yml

snap2 Check the syntax of the setup file:

[root@linuxhelp ansible_inclusion]# ansible-playbook setup.yml --syntax-check
playbook: setup.yml

Run the setup.yml file:

[root@linuxhelp ansible_inclusion]# ansible-playbook setup.yml 
PLAY [Deploying service] **************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************
ok: [client]
TASK [install the samba package] ******************************************************************************************************
ok: [client]
TASK [start the smb package] **********************************************************************************************************
changed: [client]
TASK [debugs the tasks] ***************************************************************************************************************
ok: [client] => {
    "msg": "output"
}
PLAY RECAP ****************************************************************************************************************************
client                     : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0         

Open the packages.yml file:

[root@linuxhelp ansible_inclusion]# vi packages.yml

snap3 Open the installpkg file:

[root@linuxhelp ansible_inclusion]# vi installpkg.yml 

snap4 Check the syntax of the file:

[root@linuxhelp ansible_inclusion]# ansible-playbook installpkg.yml --syntax-check
playbook: installpkg.yml

Run the installpkg file:

[root@linuxhelp ansible_inclusion]# ansible-playbook installpkg.yml
PLAY [install packages] ***************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************
ok: [client]
TASK [include packages] ***************************************************************************************************************
ok: [client]
TASK [install httpd] ******************************************************************************************************************
ok: [client]
PLAY RECAP ****************************************************************************************************************************
client                   : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

with this method creation of Ansible Inclusion comes to an end.

Tags:
ceriaimmaculate
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How do I see a list of all of the ansible_ variables?

A

Ansible by default gathers “facts” about the machines under management, and these facts can be accessed in Playbooks and in templates. To see a list of all of the facts that are available about a machine, you can run the “setup” module as an ad-hoc action:
#ansible -m setup hostname

Q

How do I copy files recursively onto a target host?

A

The “copy” module has a recursive parameter, though if you want to do something more efficient for a large number of files, take a look at the “synchronize” module instead, which wraps rsync. See the module index for info on both of these modules.

Q

How do I speed up run of ansible for servers from cloud providers?

A

Don’t try to manage a fleet of machines of a cloud provider from your laptop. Rather connect to a management node inside this cloud provider first and run Ansible from there.

Q

How do I see all the inventory variables defined for my host?

A

By running the following command, you can see inventory variables for a host:

#ansible-inventory --list --yaml

Q

Does Ansible use Python?

A

While you can write Ansible modules in any language, most Ansible modules are written in Python, including the ones central to letting Ansible work. By default, Ansible assumes it can find a /usr/bin/python on your remote system that is either Python2, version 2.6 or higher or Python3, 3.5 or higher.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.