|
1: Detection survival
zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen $ ansible all - m ping - u byrd - b 192.168.227.28 | SUCCESS = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : false , "ping" : "pong" } $ ansible web - m ping - u byrd - b 192.168.227.28 | SUCCESS = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : false , "ping" : "pong" }
2: Copy File
zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four twenty-five twenty-six twenty-seven twenty-eight twenty-nine thirty thirty-one thirty-two thirty-three thirty-four thirty-five thirty-six thirty-seven $ ansible web - m copy - a "src=/etc/fstab dest=/tmp/fstab owner=byrd group=byrd mode=644 backup=yes" 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : true , "checksum" : "daa6c89d3613142396f990d5a58f92f8853f1887" , "dest" : "/tmp/fstab" , "gid" : two thousand seven hundred and seventy , "group" : "byrd" , "md5sum" : "5715341fe9e21339a44a4338e9c10fca" , "mode" : "0644" , "owner" : "byrd" , "secontext" : "unconfined_u:object_r:user_home_t:s0" , "size" : five hundred and one , "src" : "/home/byrd/.ansible/tmp/ansible-tmp-1560839869.9026308-57960705669078/source" , "state" : "file" , "uid" : two thousand seven hundred and seventy } $ ansible web - m copy - a "src=/etc/fstab dest=/tmp/fstab owner=root group=root mode=644 backup=yes" - u byrd - b 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : true , "checksum" : "daa6c89d3613142396f990d5a58f92f8853f1887" , "dest" : "/tmp/fstab" , "gid" : zero , "group" : "root" , "mode" : "0644" , "owner" : "root" , "path" : "/tmp/fstab" , "secontext" : "unconfined_u:object_r:user_home_t:s0" , "size" : five hundred and one , "state" : "file" , "uid" : zero }
3: List Hosts
zero one two $ ansible web -- list hosts ( one ) : 192.168.227.28
4: Hard disk size
zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two $ ansible web - a "df -h" 192.168.227.28 | CHANGED | rc = zero > > Filesystem Size Used Avail Use % Mounted on / dev / sda3 798G 1.1G 797G one % / devtmpfs 477M zero 477M zero % / dev tmpfs 488M zero 488M zero % / dev / shm tmpfs 488M 7.7M 480M two % / run tmpfs 488M zero 488M zero % / sys / fs / cgroup / dev / sda1 297M 107M 191M thirty-six % / boot tmpfs 98M zero 98M zero % / run / user / zero tmpfs 98M zero 98M zero % / run / user / two thousand seven hundred and seventy $ ansible web - m shell - a "df -h" 192.168.227.28 | CHANGED | rc = zero > > Filesystem Size Used Avail Use % Mounted on / dev / sda3 798G 1.1G 797G one % / devtmpfs 477M zero 477M zero % / dev tmpfs 488M zero 488M zero % / dev / shm tmpfs 488M 7.7M 480M two % / run tmpfs 488M zero 488M zero % / sys / fs / cgroup / dev / sda1 297M 107M 191M thirty-six % / boot tmpfs 98M zero 98M zero % / run / user / zero tmpfs 98M zero 98M zero % / run / user / two thousand seven hundred and seventy
5: Yum installation
zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four twenty-five twenty-six twenty-seven twenty-eight twenty-nine thirty thirty-one thirty-two thirty-three thirty-four thirty-five thirty-six thirty-seven thirty-eight thirty-nine forty forty-one forty-two forty-three forty-four forty-five forty-six forty-seven forty-eight forty-nine $ ansible web - m yum - a 'name=redhat-lsb state=present' - u byrd - b 192.168.227.28 | SUCCESS = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : false , "msg" : "" , "rc" : zero , "results" : [ "redhat-lsb-4.1-27.el7.centos.1.x86_64 providing redhat-lsb is already installed" ] } $ ansible web - m yum - a "name=ntp state=present" - u byrd - b 192.168.227.28 | SUCCESS = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : false , "msg" : "" , "rc" : zero , "results" : [ "ntp-4.2.6p5-28.el7.centos.x86_64 providing ntp is already installed" ] } $ ansible web - m yum - a "name=net-tools state=present" - u byrd - b $ ansible web - m service - a "name=ntpd state=started" 192.168.227.28 | FAILED ! = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : false , "msg" : "Unable to start service ntpd: Failed to start ntpd.service: Connection timed out\nSee system logs and 'systemctl status ntpd.service' for details.\n" } $ ansible web - m service - a "name=ntpd state=started" - u byrd - b 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : true , "name" : "ntpd" , "state" : "started" , "status" : { ==== slightly ==== } } $ ansible web - m service - a "name=ntpd state=started enable=yes" - u byrd - b
6: System version
zero one two three four five six $ ansible web - m command - a 'lsb_release -a' 192.168.227.28 | CHANGED | rc = zero > > LSB Version : : core - four point one - amd64 : core - four point one - noarch : cxx - four point one - amd64 : cxx - four point one - noarch : desktop - four point one - amd64 : desktop - four point one - noarch : languages - four point one - amd64 : languages - four point one - noarch : printing - four point one - amd64 : printing - four point one - noarch Distributor ID : CentOS Description : CentOS Linux release 7.5.1804 ( Core ) Release : 7.5.1804 Codename : Core
7: Limited host
zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four twenty-five twenty-six twenty-seven twenty-eight twenty-nine thirty thirty-one $ ansible web - m command - a "service ntpd status" -- limit "192.168.227.28" [ WARNING ] : Consider using the service module rather than running 'service' . If you need to use command because service is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible . cfg to get rid of this message . 192.168.227.28 | FAILED | rc = two > > [ Errno two ] No such file or directory $ ansible web - m command - a "service ntpd status" -- limit "192.168.227.28" - u byrd - b [ WARNING ] : Consider using the service module rather than running 'service' . If you need to use command because service is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible . cfg to get rid of this message . 192.168.227.28 | CHANGED | rc = zero > > ● ntpd . service - Network Time Service Loaded : loaded ( / usr / lib / systemd / system / ntpd . service ; disabled ; vendor preset : disabled ) Active : active ( running ) since Tue two thousand and nineteen - 06 - eighteen fifteen : forty-seven : twenty-one CST ; 5min ago Process : sixteen thousand six hundred and thirty ExecStart =/ usr / sbin / ntpd - u ntp : ntp $ OPTIONS ( code = exited , status = zero / SUCCESS ) Main PID : sixteen thousand six hundred and thirty-one ( ntpd ) CGroup : / system . slice / ntpd . service └─ sixteen thousand six hundred and thirty-one / usr / sbin / ntpd - u ntp : ntp - g Jun eighteen fifteen : forty-seven : twenty-one Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : Listen normally on three ens33 192.168.227.28 UDP one hundred and twenty-three Jun eighteen fifteen : forty-seven : twenty-one Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : Listen normally on four lo : : one UDP one hundred and twenty-three Jun eighteen fifteen : forty-seven : twenty-one Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : Listen normally on five ens33 fe80 : : 20c : 29ff : fe01 : one thousand nine hundred and fifteen UDP one hundred and twenty-three Jun eighteen fifteen : forty-seven : twenty-one Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : Listening on routing socket on fd #22 for interface updates Jun eighteen fifteen : forty-seven : twenty-one Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : 0.0.0.0 c016 06 restart Jun eighteen fifteen : forty-seven : twenty-one Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : 0.0.0.0 c012 02 freq_set kernel zero PPM Jun eighteen fifteen : forty-seven : twenty-one Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : 0.0.0.0 c011 01 freq_not_set Jun eighteen fifteen : forty-seven : twenty-eight Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : 0.0.0.0 c61c 0c clock_step - seventy-two point nine six six nine three five s Jun eighteen fifteen : forty-six : fifteen Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : 0.0.0.0 c614 04 freq_mode Jun eighteen fifteen : forty-six : sixteen Web1 . t4x . org ntpd [ sixteen thousand six hundred and thirty-one ] : 0.0.0.0 c618 08 no_sys_peerRedirecting to / bin / systemctl status ntpd . service
8: New User
zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four twenty-five twenty-six twenty-seven twenty-eight twenty-nine thirty thirty-one thirty-two thirty-three thirty-four thirty-five thirty-six thirty-seven thirty-eight thirty-nine forty forty-one forty-two forty-three forty-four forty-five forty-six forty-seven forty-eight forty-nine fifty fifty-one fifty-two fifty-three fifty-four fifty-five fifty-six fifty-seven fifty-eight fifty-nine sixty sixty-one sixty-two sixty-three sixty-four sixty-five sixty-six sixty-seven sixty-eight sixty-nine seventy seventy-one seventy-two seventy-three seventy-four seventy-five seventy-six seventy-seven seventy-eight seventy-nine eighty eighty-one eighty-two eighty-three eighty-four eighty-five eighty-six eighty-seven eighty-eight eighty-nine ninety ninety-one ninety-two ninety-three ninety-four ninety-five ninety-six ninety-seven ninety-eight ninety-nine one hundred one hundred and one one hundred and two one hundred and three one hundred and four one hundred and five one hundred and six one hundred and seven one hundred and eight one hundred and nine one hundred and ten one hundred and eleven one hundred and twelve one hundred and thirteen one hundred and fourteen one hundred and fifteen one hundred and sixteen one hundred and seventeen one hundred and eighteen one hundred and nineteen one hundred and twenty one hundred and twenty-one one hundred and twenty-two one hundred and twenty-three one hundred and twenty-four $ ansible web - m group - a "name=http gid=498 state=present system=yes" - u byrd - b 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : true , "gid" : four hundred and ninety-eight , "name" : "http" , "state" : "present" , "system" : true } $ ansible web - m user - a "name=http uid=498 shell=/sbin/nologin group=http append=yes state=present system=yes" - u byrd - b 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : true , "comment" : "" , "create_home" : true , "group" : four hundred and ninety-eight , "home" : "/home/http" , "name" : "http" , "shell" : "/sbin/nologin" , "state" : "present" , "system" : true , "uid" : four hundred and ninety-eight } $ ansible web - m user - a "name=http groups=byrd append=no" - u byrd - b 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "append" : false , "changed" : true , "comment" : "" , "group" : four hundred and ninety-eight , "groups" : "byrd" , "home" : "/home/http" , "move_home" : false , "name" : "http" , "shell" : "/sbin/nologin" , "state" : "present" , "uid" : four hundred and ninety-eight } $ ansible web - m user - a "name=http groups=http append=no" - u byrd - b 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "append" : false , "changed" : true , "comment" : "" , "group" : four hundred and ninety-eight , "groups" : "http" , "home" : "/home/http" , "move_home" : false , "name" : "http" , "shell" : "/sbin/nologin" , "state" : "present" , "uid" : four hundred and ninety-eight } $ ansible web - m user - a "name=http state=absent remove=yes" - u byrd - b 192.168.227.28 | CHANGED = > { "ansible_facts" : { "discovered_interpreter_python" : "/usr/bin/python" } , "changed" : true , "force" : false , "name" : "http" , "remove" : true , "state" : "absent" , "stderr" : "userdel: http mail spool (/var/spool/mail/http) not found\n" , "stderr_lines" : [ "userdel: http mail spool (/var/spool/mail/http) not found" ] } $ ansible web - m user - a "name=http uid=498 shell=/sbin/nologin group=http append=yes state=present system=yes " - u byrd - t system = yes expires = one billion five hundred and sixty million eight hundred and forty-six thousand two hundred and fifty-eight " -u byrd -b 192.168.227.28 | CHANGED => { " ansible_facts ": { " discovered_interpreter_python ": " / usr / bin / python " }, " changed ": true, " comment ": " ", " create_home ": true, " group ": 498, " home ": " / home / http ", " name ": " http ", " shell ": " / sbin / nologin ", " state ": " present ", " system ": true, " uid ": 498 } $ ansible web -m user -a " name = byrd shell =/ bin / bash password = bynwXEWgZfiUg update_password = always " -u byrd -b [WARNING]: The input password appears not to have been hashed. The 'password' argument must be encrypted for this module to work properly. 192.168.227.28 | CHANGED => { " ansible_facts ": { " discovered_interpreter_python ": " / usr / bin / python " }, " append ": false, " changed ": true, " comment ": " ", " group ": 2770, " home ": " / home / byrd ", " move_home ": false, " name ": " byrd ", " password ": " NOT_LOGGING_PASSWORD ", " shell ": " / bin / bash ", " state ": " present ", " uid ": 2770 } $ python3 Python 3.6.5 (default, Jun 18 2019, 12:09:59) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type " help ", " copyright ", " credits " or " license " for more information. >>> import crypt >>> print(crypt.crypt(" one hundred and twenty-three thousand four hundred and fifty-six ", " byrd " ) ) bynwXEWgZfiUg SourceByrd's Weblog- https://note.t4x.org/basic/ansible-ad-hoc/
|
|
|