this can be '*' which means run: yum -y update. You can also pass a url or a local...
ok: [node1] TASK [yum_repo2]***ok: [node1] TASK [mount /dev/cdrom]*** ok: [node1] TASK [yum http]***
- name: Update yum repo copy: src={{ item }} dest=/etc/yum.repos.d/ with_fileglob: - yum/CentOS-Base.repo - yum/docker-ce.repo - name: Basic lib install yum: name={{ item }} state=latest update_cache=yes with_items: - epel-release - libselinux-python - glibc - gcc - make...
首先执行以下命令: # 更新系统sudoyum update-y# 安装EPEL库sudoyuminstallepel-release-y# 安装Ansiblesudoyuminstallansible-y# 安装Python的MySQL模块sudoyuminstallpython3-devel mysql-devel-y 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 接下来通过甘特图对环境搭建的时间进行规划: 2023-10-012023-10-0...
在ansible-playbook 中使用 yum 模块的基本语法结构如下: yaml - name: Playbook的名称 hosts: 目标主机或主机组 tasks: - name: 任务的名称 yum: name: 软件包的名称 # 要安装、升级或卸载的软件包名称 state: present|latest|absent # 指定软件包的状态(安装、最新、卸载) update_cache: yes|no # 是否在...
{item}}state=absentwith_items:-/var/lib/docker-/var/run/docker-name:install yum-utilsyum:name=yum-utils state=present-name:add docker reposhell:yum-config-manager--add-repo{{docker.repo}}-name:install docker-ceyum:name={{docker.version}}state=present update_cache=True-name:setdocker ...
yum: name: - nginx state: latest download_only: true 2.配置模板管理 - name: Update sshd configuration safely, avoid locking yourself out template: src: etc/ssh/sshd_config.j2 dest: /etc/ssh/sshd_config owner: root group: root mode: '0600' ...
会自动判断系统版本,然后安装不同的包,本来想弄好yum的update源,但发现还在更新,觉得麻烦就还自己安装文件了。 2、安装前测试系统(centos 6系统) 为了测试需要,使用docker虚拟个容器 1 2 3 4 5 6 7 8 9 10 11 16:32:46# ssh 172.17.0.9 The authenticity of host'172.17.0.9 (172.17.0.9)'can't be...
[root@Monitor ansible] # vim update_bash.yml - hosts: all remote_user: root gather_facts: True tasks: - name: update bash in redhat 6 version yum: name=http: //mirrors .aliyun.com /centos/6 .6 /os/x86_64/Packages/bash-4 .1.2 ...
第一个play会在webservers主机上执行两个task, 把httpd服务通过yum更新到最新版本, 然后根据/srv/httpd.j2模板生成/etc/httpd.conf配置文件 第二个play会在daatbases主机执行两个task, 把postgresql升级到最新版, 然后启动postgresql服务 ---name:Updatewebservershosts:webserversremote_user:roottasks:-name:Ensure...