Giter VIP home page Giter VIP logo

justin-p / ansible-role-posh5 Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 3.0 51 KB

Update PowerShell/Windows Management Framework to Version 5.1, enure that .Net applications use Strong TLS, configure NuGet, PowerShell Gallery, PowerShellGet and install the PSReadline Module.

License: MIT License

ansible ansible-galaxy ansible-role hacktoberfest microsoft posh posh5 powershell powershell5 windowsmanagementframework wmf

ansible-role-posh5's Introduction

pppp                               pppp            pppppppppppp
pppp                               pppp            pppppppppppp
pppp                               pppp            pppppppppppp
pppp                               pppp            pppppppppppp
pppppppppppp                                           pppp
pppppppppppp                                           pppp
pppppppppppp                                           pppp
pppppppppppp                                           pppp
pppp                               pppp            pppppppppppp
pppp                               pppp            pppppppppppp
pppp                               pppp            pppppppppppp
pppp                               pppp            pppppppppppp

ansible-role-posh5's People

Contributors

justin-p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ansible-role-posh5's Issues

Failed to find choco.exe without justin_p.wincom

Hello! Thanks for
If i run playbook without justin_p.wincom

- hosts: primarydomaincontroller
  roles:
    - role: justin_p.posh5

I get error

TASK [justin_p.posh5 : Ensure Windows Management Framework/PowerShell 5.1 are installed] ***********************************************************************************************
task path: /home/user/.ansible/roles/justin_p.posh5/tasks/main.yml:3
[WARNING]: Chocolatey was missing from this system, so it was installed during this task run.
fatal: [dc2022]: FAILED! => changed=true
  invocation:
    module_args:
      allow_empty_checksums: false
      allow_multiple: false
      allow_prerelease: false
      architecture: default
      choco_args: null
      force: false
      ignore_checksums: false
      ignore_dependencies: false
      install_args: null
      name:
      - powershell
      override_args: false
      package_params: null
      pinned: null
      proxy_password: null
      proxy_url: null
      proxy_username: null
      remove_dependencies: false
      skip_scripts: false
      source: null
      source_password: null
      source_username: null
      state: present
      timeout: 2700
      validate_certs: true
      version: null
  msg: Failed to find choco.exe, make sure it is added to the PATH or the env var 'ChocolateyInstall' is set
  rc: 0

If i run playbook

- hosts: primarydomaincontroller
  roles:
    - role: justin_p.posh5
    - role: justin_p.wincom

Then no error

TASK [justin_p.posh5 : Ensure Windows Management Framework/PowerShell 5.1 are installed] ***********************************************************************************************
task path: /home/user/.ansible/roles/justin_p.posh5/tasks/main.yml:3
[WARNING]: Chocolatey was missing from this system, so it was installed during this task run.
changed: [dc2022] => changed=true
  invocation:
    module_args:
      allow_empty_checksums: false
      allow_multiple: false
      allow_prerelease: false
      architecture: default
      choco_args: null
      force: false
      ignore_checksums: false
      ignore_dependencies: false
      install_args: null
      name:
      - powershell
      override_args: false
      package_params: null
      pinned: null
      proxy_password: null
      proxy_url: null
      proxy_username: null
      remove_dependencies: false
      skip_scripts: false
      source: null
      source_password: null
      source_username: null
      state: present
      timeout: 2700
      validate_certs: true
      version: null
  rc: 0
  stdout: |-
    Installing the following packages:
    powershell
    By installing, you accept licenses for the packages.

    PowerShell v5.1.14409.20180811 [Approved]
    powershell package files install completed. Performing other installation steps.
    Running on: Windows Server 2022 Datacenter, (ServerDatacenter), Windows Kernel: 10.0.20348
    WARNING: PowerShell version, 5.1.20348.558, is already installed.
     The install of powershell was successful.
      Software install location not explicitly set, it could be in package or
      default install location of installer.

    Chocolatey installed 1/1 packages.
     See the log for details (C:\ProgramData\Chocolatey\logs\chocolatey.log).
  stdout_lines: <omitted>
Friday 18 March 2022  09:51:02 +0600 (0:00:20.506)       0:00:26.183 **********
Friday 18 March 2022  09:51:02 +0600 (0:00:00.000)       0:00:26.183 **********
redirecting (type: action) ansible.builtin.win_reboot to ansible.windows.win_reboot
META: ran handlers
Friday 18 March 2022  09:51:02 +0600 (0:00:00.014)       0:00:26.197 **********
redirecting (type: modules) ansible.builtin.win_regedit to ansible.windows.win_regedit
Using module file /home/user/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_regedit.ps1
Pipelining is enabled.
<51.250.36.64> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 51.250.36.64
EXEC (via pipeline wrapper)
redirecting (type: modules) ansible.builtin.win_regedit to ansible.windows.win_regedit

TASK [justin_p.posh5 : Ensure strong cryptography is set for .Net Framework (x86 and x64, Version 4 and above)] ************************************************************************
task path: /home/user/.ansible/roles/justin_p.posh5/tasks/main.yml:16
changed: [dc2022] => (item=HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319) => changed=true
  ansible_loop_var: item
  data_changed: false
  data_type_changed: false
  invocation:
    module_args:
      data: 1
      delete_key: true
      hive: null
      name: SchUseStrongCrypto
      path: HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319
      state: present
      type: dword
  item: HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319
Using module file /home/user/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_regedit.ps1
Pipelining is enabled.
EXEC (via pipeline wrapper)
changed: [dc2022] => (item=HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319) => changed=true
  ansible_loop_var: item
  data_changed: false
  data_type_changed: false
  invocation:
    module_args:
      data: 1
      delete_key: true
      hive: null
      name: SchUseStrongCrypto
      path: HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319
      state: present
      type: dword
  item: HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319
Friday 18 March 2022  09:51:05 +0600 (0:00:03.509)       0:00:29.707 **********
redirecting (type: modules) ansible.builtin.win_shell to ansible.windows.win_shell
Using module file /home/user/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_shell.ps1
Pipelining is enabled.
<51.250.36.64> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 51.250.36.64
EXEC (via pipeline wrapper)

TASK [justin_p.posh5 : Ensure NuGet Package Provider is installed] *********************************************************************************************************************
task path: /home/user/.ansible/roles/justin_p.posh5/tasks/main.yml:26
changed: [dc2022] => changed=true
  cmd: |-
    $PackageProvider = Get-PackageProvider -ListAvailable | Where-Object {($_.name -eq 'Nuget') -and ($_.version -ge "2.8.5.201")}
    If (-not ($PackageProvider)){
      Try {
        [void](Install-PackageProvider -Name NuGet -Scope AllUsers -MinimumVersion 2.8.5.201 -Confirm:$False -ErrorAction Stop -Force)
        exit 1
      } Catch {
         exit 2
      }
    } Else {
      exit 0
    }
  delta: '0:00:08.828121'
  end: '2022-03-18 03:51:17.765763'
  failed_when_result: false
  msg: non-zero return code
  rc: 1
  start: '2022-03-18 03:51:08.937641'
  stderr: ''
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>
Friday 18 March 2022  09:51:16 +0600 (0:00:10.634)       0:00:40.341 **********
redirecting (type: modules) ansible.builtin.win_shell to ansible.windows.win_shell
Using module file /home/user/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_shell.ps1
Pipelining is enabled.
<51.250.36.64> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 51.250.36.64
EXEC (via pipeline wrapper)

TASK [justin_p.posh5 : Ensure Powershell Gallery is installed] *************************************************************************************************************************
task path: /home/user/.ansible/roles/justin_p.posh5/tasks/main.yml:43
changed: [dc2022] => changed=true
  cmd: |-
    $PowershellGallery = Get-PSRepository | Where-Object {$_.name -eq 'PSGallery'}
    if (-not ($PowershellGallery)){
      Try {
        If ( $($PSVersionTable.PSVersion).major -le 4) {
          [void](Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/ -InstallationPolicy Trusted -ErrorAction Stop)
        } Else {
          [void](Register-PSRepository -Default -InstallationPolicy Trusted -ErrorAction Stop)
        }
        exit 1
      }
      Catch {
        exit 2
      }
    } ElseIf ($PowershellGallery.InstallationPolicy -ne 'Trusted') {
        Try {
          [void](Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -ErrorAction Stop)
          exit 1
        }
       Catch {
        exit 2
       }
    }
    Else {
      exit 0
    }
  delta: '0:00:16.078108'
  end: '2022-03-18 03:51:35.500136'
  failed_when_result: false
  msg: non-zero return code
  rc: 1
  start: '2022-03-18 03:51:19.422028'
  stderr: ''
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>
Friday 18 March 2022  09:51:33 +0600 (0:00:17.737)       0:00:58.079 **********
redirecting (type: modules) ansible.builtin.win_shell to ansible.windows.win_shell
Using module file /home/user/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_shell.ps1
Pipelining is enabled.
<51.250.36.64> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 51.250.36.64
EXEC (via pipeline wrapper)
Friday 18 March 2022  09:51:36 +0600 (0:00:02.399)       0:01:00.478 **********
redirecting (type: modules) ansible.builtin.win_psmodule to community.windows.win_psmodule
Using module file /home/user/.ansible/collections/ansible_collections/community/windows/plugins/modules/win_psmodule.ps1
Pipelining is enabled.
<51.250.36.64> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 51.250.36.64
EXEC (via pipeline wrapper)
META: role_complete for dc2022
Friday 18 March 2022  09:51:40 +0600 (0:00:03.809)       0:01:04.288 **********
Friday 18 March 2022  09:51:40 +0600 (0:00:00.027)       0:01:04.315 **********
redirecting (type: modules) ansible.builtin.win_psmodule to community.windows.win_psmodule
Using module file /home/user/.ansible/collections/ansible_collections/community/windows/plugins/modules/win_psmodule.ps1
Pipelining is enabled.
<51.250.36.64> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 51.250.36.64
EXEC (via pipeline wrapper)
redirecting (type: modules) ansible.builtin.win_psmodule to community.windows.win_psmodule

TASK [justin_p.wincom : Ensure that required DSC resources and Powershell Modules are present] *****************************************************************************************
task path: /home/user/.ansible/roles/justin_p.wincom/tasks/main.yml:13
changed: [dc2022] => (item=xPSDesiredStateConfiguration) => changed=true
  ansible_loop_var: item
  item: xPSDesiredStateConfiguration
  nuget_changed: false
  output: Module xPSDesiredStateConfiguration installed
  repository_changed: false
Using module file /home/user/.ansible/collections/ansible_collections/community/windows/plugins/modules/win_psmodule.ps1
Pipelining is enabled.
EXEC (via pipeline wrapper)
redirecting (type: modules) ansible.builtin.win_psmodule to community.windows.win_psmodule
changed: [dc2022] => (item=NetworkingDsc) => changed=true
  ansible_loop_var: item
  item: NetworkingDsc
  nuget_changed: false
  output: Module NetworkingDsc installed
  repository_changed: false
Using module file /home/user/.ansible/collections/ansible_collections/community/windows/plugins/modules/win_psmodule.ps1
Pipelining is enabled.
EXEC (via pipeline wrapper)
changed: [dc2022] => (item=ComputerManagementDsc) => changed=true
  ansible_loop_var: item
  item: ComputerManagementDsc
  nuget_changed: false
  output: Module ComputerManagementDsc installed
  repository_changed: false
Friday 18 March 2022  09:52:25 +0600 (0:00:45.264)       0:01:49.580 **********
redirecting (type: modules) ansible.builtin.win_service to ansible.windows.win_service
Using module file /home/user/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_service.ps1
Pipelining is enabled.
<51.250.36.64> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 51.250.36.64
EXEC (via pipeline wrapper)

TASK [justin_p.wincom : Ensure that required services are set to start when the system has settled] ************************************************************************************
task path: /home/user/.ansible/roles/justin_p.wincom/tasks/main.yml:19
changed: [dc2022] => (item=WinRM) => changed=true
  ansible_loop_var: item
  can_pause_and_continue: false
  depended_by: []
  dependencies:
  - RPCSS
  - HTTP
  description: Windows Remote Management (WinRM) service implements the WS-Management protocol for remote management. WS-Management is a standard web services protocol used for remote software and hardware management. The WinRM service listens on the network for WS-Management requests and processes them. The WinRM Service needs to be configured with a listener using winrm.cmd command line tool or through Group Policy in order for it to listen over the network. The WinRM service provides access to WMI data and enables event collection. Event collection and subscription to events require that the service is running. WinRM messages use HTTP and HTTPS as transports. The WinRM service does not depend on IIS but is preconfigured to share a port with IIS on the same machine.  The WinRM service reserves the /wsman URL prefix. To prevent conflicts with IIS, administrators should ensure that any websites hosted on IIS do not use the /wsman URL prefix.
  desktop_interact: false
  display_name: Windows Remote Management (WS-Management)
  exists: true
  invocation:
    module_args:
      dependencies: null
      dependency_action: set
      description: null
      desktop_interact: false
      display_name: null
      error_control: null
      failure_actions: null
      failure_actions_on_non_crash_failure: null
      failure_command: null
      failure_reboot_msg: null
      failure_reset_period_sec: null
      force_dependent_services: false
      load_order_group: null
      name: WinRM
      password: null
      path: null
      pre_shutdown_timeout_ms: null
      required_privileges: null
      service_type: null
      sid_info: null
      start_mode: delayed
      state: null
      update_password: null
      username: null
  item: WinRM
  name: WinRM
  path: C:\Windows\System32\svchost.exe -k NetworkService -p
  start_mode: delayed
  state: running
  username: NT AUTHORITY\NetworkService

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.