利用saltstack初始化OpenStack服务器环境
目录架构图如上图所示
sls脚本详情如下:
Sync_Host: file.managed: - name: /etc/hosts - source: salt://state/files/hosts - user: root - group: root - mode: 644 install_httpd: pkg.installed: - name: httpd - name: httpd-devel httpd_running: service.running: - name: httpd - enable: True - require: - pkg: install_httpd - watch: - file: httpd_conf httpd_conf: file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://state/files/httpd.conf - user: root - group: root - mode: 644 - template: jinja - defaults: hostname: localhost cp_openstack_source: file.managed: - name: /var/www/html/openstack-mitaka-rpms.tar.gz - source: salt://state/files/openstack-mitaka-rpms.tar.gz - user: root - group: root - mode: 644 uncompress_openstackPack: cmd.run: - name: cd /var/www/html && tar xf openstack-mitaka-rpms.tar.gz && mv openstack-mitaka-rpms.tar.gz /tmp mv_old_epel: cmd.run: - name: cd /etc/yum.repos.d && mv *.repo /tmp mitaka_repo: file.managed: - name: /etc/yum.repos.d/mitaka.repo - source: salt://state/files/mitaka.repo - user: root - group: root - mode: 644 - template: jinja - default: IP: 192.168.74.155 all_install: cmd.run: - name: yum clean all && yum install vim -y yum_conf: file.managed: - name: /etc/yum/yum-cron.conf - source: salt://state/files/yum-cron.conf - user: root - group: root - mode: 644 install_openstack_pre: pkg.installed: - name: openstack_pre - pkgs: - python-openstackclient - openstack-selinux - chrony stop_selinux_firewalld: cmd.run: - name: sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config && systemctl disable firewalld.service && systemctl stop firewalld.service ntp_conf: file.managed: - name: /etc/chrony.conf - source: salt://state/files/chrony.conf - user: root - group: root - mode: 644 ntp_running: service.running: - name: chronyd - enable: True - require: - pkg: install_openstack_pre sync_time: cmd.run: - name: chronyc sources
因配置很长,就不贴出来了,我把用到的东西传到百度云里,需要的就自己下载吧 链接: http://pan.baidu.com/s/1o8yliFC 密码: mt3q,接下来继续完成吧,争取完成一键部署openstack架构
天天向上,空杯心态。