Commit 339f6d37 authored by JooHan Hong's avatar JooHan Hong

2021-03-09, update2

parent cec510bc
Pipeline #5131 passed with stages
in 2 seconds
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
## 주요 기능 ## 주요 기능
- 수행 후 APT_PACKAGES/*IP주소*/*일자*/dpkg_result.txt 파일을 남기도록 한다. - OS Minimal 설치 후 최소한의 Package를 설치한다.
- RedHat/Debian 계열에 따라 조건을 수행한다.
## Inventory 설정 ## Inventory 설정
...@@ -42,8 +43,8 @@ ansible_python_interpreter: python2.7 ...@@ -42,8 +43,8 @@ ansible_python_interpreter: python2.7
```python ```python
--- ---
- name: Debian(Minimal Install) Basic APT Package Install - name: Basic OS Package Installing
hosts: DEPLOY hosts: ALL_HOSTS
vars: vars:
time: "{{lookup('pipe','date \"+%Y%m%d_%H%M\"')}}" time: "{{lookup('pipe','date \"+%Y%m%d_%H%M\"')}}"
environment: environment:
...@@ -83,10 +84,13 @@ ansible_python_interpreter: python2.7 ...@@ -83,10 +84,13 @@ ansible_python_interpreter: python2.7
stat: stat:
path: /etc/apt/sources.list_src path: /etc/apt/sources.list_src
register: apt_sourcelist_backup register: apt_sourcelist_backup
when: ansible_os_family == "Debian"
- name: /etc/apt/sources.list_src file backup - name: /etc/apt/sources.list_src file backup
command: cp -rf /etc/apt/sources.list /etc/apt/sources.list_src command: cp -rf /etc/apt/sources.list /etc/apt/sources.list_src
when: apt_sourcelist_backup.stat.exists == False when:
- apt_sourcelist_backup.stat.exists == False
- ansible_os_family == "Debian"
- name: APT source sources.list file copy - name: APT source sources.list file copy
copy: copy:
...@@ -95,9 +99,9 @@ ansible_python_interpreter: python2.7 ...@@ -95,9 +99,9 @@ ansible_python_interpreter: python2.7
owner: 'root' owner: 'root'
group: 'root' group: 'root'
mode: 0644 mode: 0644
#attr: i
with_items: with_items:
['sources.list_9_130'] ['sources.list']
when: ansible_os_family == "Debian"
- name: Install a list of packages - name: Install a list of packages
apt: apt:
...@@ -125,6 +129,7 @@ ansible_python_interpreter: python2.7 ...@@ -125,6 +129,7 @@ ansible_python_interpreter: python2.7
- mdadm - mdadm
- nfs-common - nfs-common
update_cache: yes update_cache: yes
when: ansible_os_family == "Debian"
- name: Stop & Disabled Serivces - name: Stop & Disabled Serivces
systemd: systemd:
...@@ -133,6 +138,62 @@ ansible_python_interpreter: python2.7 ...@@ -133,6 +138,62 @@ ansible_python_interpreter: python2.7
enabled: no enabled: no
with_items: with_items:
- exim4 - exim4
when: ansible_os_family == "Debian"
- name: Install a list of packages
yum: name={{ item }} update_cache=yes
with_items:
- vim
- telnet
- lvm2
- sysstat
- ftp
- device-mapper-multipath
- device-mapper-multipath-lib
- setuptool
- sysfsutils
- sg3_utils
- dos2unix
- lsof
- iptstate
- ipmitool
- lrzsz
- zlib-devel
- tcl
- tcl-devel
- cmake
- nmap
- iptraf
- tcpdump
- net-tools
- psmisc
- tree
- rdate
- bash-completion
- wget
- gcc
- gcc-c++
- openssl
- openssl-devel
- zip
- unzip
- autoconf
- smartmontools
- ncurses-devel
- rsync
- bind-utils
- ntp
- chrony
when: ansible_os_family == "CentOS"
- name: Stop & Disabled Serivces
systemd:
name: "{{ item }}"
state: stopped
enabled: no
with_items:
- postfix
when: ansible_os_family == "CentOS"
``` ```
......
...@@ -71,6 +71,7 @@ ansible_python_interpreter: python2.7 ...@@ -71,6 +71,7 @@ ansible_python_interpreter: python2.7
`OS Package Manager`에 대한 Playbook 분석 `OS Package Manager`에 대한 Playbook 분석
* [ ] Inventory에 지정된 호스트가 만약 Debian 계열이라면 dpkg-query -f '${binary:Package}\n' -W 명령을 수행한다. * [ ] Inventory에 지정된 호스트가 만약 Debian 계열이라면 dpkg-query -f '${binary:Package}\n' -W 명령을 수행한다.
* [ ] Inventory에 지정된 호스트가 만약 RedHat 계열이라면 rpm -qa 명령을 수행한다.
* [ ] 수행 Sheel 상에서 결과를 출력하고, 증적은 APT_PACKAGES/ 디렉토리에 기록한다. * [ ] 수행 Sheel 상에서 결과를 출력하고, 증적은 APT_PACKAGES/ 디렉토리에 기록한다.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment