nxis, ios 구분을 인벤토리에서 구분하여 when조건으로 실행 한다. hosts - inventory [network:children] nxos ios [nxos] nxos01 ansible_host=10.60.50.13 [nxos:vars] ansible_connection=network_cli ansible_network_os=nxos ansible_user=fendys ansible_password=password1! [ios] ios01 ansible_host=10.6.99.176 ios01 ansible_host=10.3.99.145 [ios:vars] ansible_connection=network_cli ansible_network_os=ios ansible_user=fendys ans..
sed command를 통해서 아래 포함할문구1 또는 포함할문구2 가 있는 라인은 삭제 하고 /data/result/filename명으로 저장한다. #!/bin/bash for file in ls * do if [ -f $file ] then tmpfile="$file" mkdir -p /data/result wc -l $file >> /data/result/result.log sed -e '/{포함할문구1}\|{포함할문구2}/d' $file > /data/result/$tmpfile wc -l /data/result/$file >> /data/result/result.log fi done sed command를 통해서 아래 {team\\\":{\\\"number\\\":\\\"[0-9]\{16\}} 을..
사전 조건 유저가 직접 패스워드 변경 해야됨 명령어 통제를 그룹 단위로 하고 있음 초기 로그인 시도 시 무조건 패스워드 변경 해야됨 신규 유저 생성시 패스워드 만료 작업이 자주 누락되어 사용함 #!/bin/bash read -p "Your name : " user PS3='Please Select team: ' select team in "a-team" "b-team" do echo "$team - $user " useradd -g $team $user echo 'password1!' | passwd --stdin $user passwd --expire $user break done exit 0
#!/bin/bash today=$(date +%Y%m%d') rbashuser=$(cat /etc/passwd |grep rbash |awk 'BEGIN {FS = ":"} {print $1}'|egrep -v "root|nike|secupang") for user in $rbashuser do auser=$user buser=$(lastlog -u $user |grep $user |awk '{print $1}') #buser=$(lastlog -b 90 -u $user |grep $user |awk '{print $1}') if [ "$auser" != "$buser" ] then echo $auser login !! else echo $auser nologin 90day change nologin ..
ad join이 불가한 상황에 유저 패스워드 만료 및 어카운트 비활성화 관련 bash scripts cron해서 사용 하면 됨 #!/bin/bash today=$(date +%Y%m%d) expiredate=$(date -d "+1 week" "+%Y-%m-%d") rbashuser=$(cat /etc/passwd |grep rbash |awk 'BEGIN {FS = ":"} {print $1}'|egrep -v "root|admin") for user in $rbashuser do auser=$user buser=$(lastlog -b 90 -u $user |grep $user |awk '{print $1}') if [ "$auser" != "$buser" ] then resultuser=$(chage..
스크립트 실행시 상대 경로의 파일을 못찾을때는 chdir: prefix 설정해주면 상대 경로의 원격지 스크립트가 정삭적으로 수행 된다. --- - name: mkdir solid_step client direct shell: 'mkdir -p /fendys/solied_step' ################################################################################################################################################################ - name: Get solid_step client file shell: 'wget -P /fendys/solied_step --no-chec..
s3 버킷을 삭제 할때 파일 또는 폴더가 너무 많은경우 사용하면 유용한 케이스다 현재 설정된 lifecycle 확인 하는 방법 cli : aws s3api get-bucket-lifecycle --bucket fendys-s3-bucket --profile aws-fendys 새로운 lifecycle 설정하기 cli : aws s3api put-bucket-lifecycle-configuration --bucket fendys-s3-bucket --lifecycle-configuration file://fendys-lifecycle.json --profile aws-fendys fendys-lifecycle.json 내용 { "Rules": [ { "Expiration": { "Days": 1 }, "I..
- Total
- Today
- Yesterday
- dl20 centos7
- vm rac
- CentOS 7 GUI
- 특정 라인삭제
- centos7 ntp
- ansible network
- cgroup
- 리눅스 커맨드 로그남기기
- nxos ansible
- dependency fail
- chrony
- ILO
- shell connmad log
- nutanix rac
- cmd로 윈도우 계정 관리
- ISCSI 볼륨 RAC
- linux command log
- DL20 GEN9 장비에 CentOS 7
- 윈도우서버 계정 관려
- dl20
- 윈도우 cmd 계정 관리
- dl20 g9 centos7 설치
- cmd로 계정 생성
- ios ansible
- ipmi
- windows.old 강제삭제
- cisco ansible
- linux7 ntp
- 특정 문구 치환
- ansible ios
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |