본문 바로가기
반응형

ansible3

Ansible ssh-keygen 귀찮을 때 Ansible ssh-keygen 해서 연결하기 귀찮을 때 패스워드 한번만 쓰면 더 안써도 되는 방법 >> sshpass를 쓰자 1) sshpass 설치 # yum install sshpass 2) ansible 실행 # ansible -m shell -a "명령어" -u [ID] [대상] --ask-pass 2번째부터는 옵션 빼줘도 됨 # ansible -m shell -a "명령어" -u [ID] [대상] ex) 프롬프트 안물어보고 실행하고 싶을 때 # sshpass -p [비밀번호] ansible-playbook -i testserver test.yaml --ask-pass # sshpass -p [비밀번호] ansible -m shell -a "[명령어]" -u [ID] [대상] --ask-pas.. 2022. 5. 23.
nginx_install.yml --- - name: Install nginx on linux hosts: nginx gather_facts: no tasks: - name: install epel-release yum: name=epel-release state=latest - name: install nginx web server yum: name=nginx state=present - name: upload default index.html for web server get_url: url=https://www.nginx.com dest=/usr/share/nginx/html mode=0644 - name: start nginx web server service: name=nginx state=started 2022. 3. 31.
ansible 구축/실행 명령어 모음 [Ansible 설치] yum install -y perl ## vmware-tools 설치할 때 필요해서 넣어둠 yum install -y epel-release ## CentOS ansible은 epel 에 있음 yum install -y ansible ## Ansible 설치 yum install -y python3 ## 요즘 python은 3버전 쓴대서 추가 yum install python-pip -y ## python 기반 install은 pip pip install ansible-cmdb ## ansible-cmdb는 pip 로 설치 yum install python-mako -y ## ansible-cmdb 실행시 mako 요구 yum install nginx -y ## ansible-cm.. 2022. 3. 31.
반응형