yeonghoon.kim

  • 게시판
  • 갤러리
  • aws

CentOS8 초기 설정 - centos8_init.yml

김영훈 2019.09.29 10:18 조회 수 : 273

---
- hosts: centos8_init
  become: yes

  vars:
    hostname: localhost
    user: ioniere
    user_passwd: secret

  tasks:
  - name: 호스트네임 설정
    hostname:
      name: ""{{ hostname }}""

  - name: 불필요한 데몬 구동되지 않도록 설정
    service:
      name: '{{ item }}'
      state: stopped
      enabled: no
    with_items:
      - firewalld
      - import-state
      - irqbalance
      - kdump
      - microcode
      - nis-domainname
      - rngd
      - selinux-autorelabel-mark
      - sssd
      - tuned
      - sssd-kcm.socket

  - name: SELINUX 비활성화
    selinux:
      state: disabled

  - name: 불필요한 계정 삭제
    user:
      name: ""{{ item }}""
      state: absent
    with_items:
      - ftp
      - adm
      - lp
      - shutdown
      - halt
      - operator
      - games

  - name: 관리자 계정 생성
    user:
      name: ""{{ user }}""
      password: ""{{ user_passwd | password_hash('sha512') }}""
      groups: wheel

  - name: su 파일 권한 및 소유권 설정
    file:
      path: /bin/su
      owner: root
      group: wheel
      mode: 04750

  - name: wheel 그룹에 포함되어 있는 유저만 su 사용가능하도록 설정
    pamd:
      name: su
      type: auth
      control: sufficient
      module_path: pam_rootok.so
      new_type: auth
      new_control: required
      new_module_path: pam_wheel.so
      module_arguments: 'use_uid'
      state: after

  - name: SSHD ROOT 로그인 불허
    replace:
      dest: /etc/ssh/sshd_config
      regexp: ""^PermitRootLogin yes""
      replace: ""PermitRootLogin no""

  - name: SSHD ipv4로만 작동하도록 설정
    replace:
      path: /etc/ssh/sshd_config
      regexp: ""^#ListenAddress 0.0.0.0""
      replace: ""ListenAddress 0.0.0.0""

  - name: yum 업데이트
    yum:
      name: ""*""
      state: latest

  - name: 히스토리 개수 변경
    lineinfile:
      dest: /etc/profile
      regexp: ""^HISTSIZE""
      line: ""HISTSIZE=10000""

  - name: 히스토리 시간 보이도록 설정
    lineinfile:
      dest: /etc/profile
      line: ""HISTTIMEFORMAT=\""[%Y-%m-%d %H:%M:%S] \""\nexport HISTTIMEFORMAT""
      insertafter: EOF

  - name: 기본 프로그램 설치
    yum:
      name: ['iptables-services', 'vim-enhanced', 'net-tools', 'psmisc', 'wget', 'git']
      state: latest

  - name: iptables 구동
    service:
      name: iptables
      state: started
      enabled: yes

-변수 수정 후 사용
hostname: 호스트명
user: 관리자계정
user_passwrd: 관리자 계정 패스워드


  • 추천 0

  • 비추천 0
이 게시물을
목록

댓글 0

사진 및 파일 첨부

여기에 파일을 끌어 놓거나 왼쪽의 버튼을 클릭하세요.

파일 용량 제한 : 0MB (허용 확장자 : *.*)

업로드 중... (0%)

0개 첨부 됨 ( / )
 
번호 제목 글쓴이 날짜 조회 수
공지 2025 일본 여행 계획 김영훈 2024.10.10 1106
공지 현금, 저축, 투자, 지출, 예산, 보험 내역(2024-05-30) 김영훈 2024.03.10 763
» CentOS8 초기 설정 - centos8_init.yml 김영훈 2019.09.29 273
264 CentOS7 docker_ce 설치 - centos7_docker.yml 김영훈 2019.09.29 388
263 인터넷 익스플로러 cockpit 사용 불가 김영훈 2019.09.30 58
262 kvm virt-install 예시 김영훈 2019.09.30 356
261 CentOS8 npm 설치(저사양) - centos8_npm.yml 김영훈 2019.09.30 4675
260 CentOS8 MariaDB 저사양용 - /etc/my.cnf.d/mariadb-server.cnf 김영훈 2019.09.30 90
259 CentOS8 svn 설치 - centos8_svnserver.yml 김영훈 2019.09.30 114
258 CentOS8 vsftpd 설치 - centos8_vsftpd.yml 김영훈 2019.10.01 336
257 CentOS8 network-scripts 김영훈 2019.10.04 91
256 맥OS 미리알림 동기화 안되는 문제 김영훈 2019.10.04 132
255 CentOS8 postfix 설치 - centos8_postfix.yml 김영훈 2019.10.04 305
254 도메인 만료 관련 피싱 메일 김영훈 2019.10.06 291
253 도메인 기관 이전 절차 김영훈 2019.10.06 394
252 제습기 - 신일 SDH-PM360 김영훈 2019.10.09 277
251 CentOS8 dovecot 설치 - centos8_dovecot.yml 김영훈 2019.10.10 353
250 CentOS8 nagios 설치(yum/dnf) 김영훈 2019.10.11 252
249 맥 카탈리나 사이드카 구동 시 속도 저하 문제 김영훈 2019.10.12 252
248 맥 카탈리나 업그레이드 이후 svn 작동 안되는 현상 해결법 김영훈 2019.10.13 118
247 마우스 - 애플 매직마우스2 김영훈 2019.10.13 481
246 CentOS8 bind 설치 - centos8_bind.yml 김영훈 2019.10.15 308
쓰기 태그
 첫 페이지 1 2 3 4 5 6 7 8 9 10 끝 페이지