juju4 / ansible-powershell

Set Powershell on linux, including config file and logging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Actions Status - Master Actions Status - Devel

powershell ansible role

Setup powershell, its config and logging under linux.

See also

Requirements & Dependencies

Ansible

It was tested on the following versions:

  • 2.13

Operating systems

Tested on Ubuntu 20.04 and 22.04.

Example Playbook

Just include this role in your list. For example

- host: myhost
  roles:
    - juju4.powershell

you probably want to review variables

Variables

powershell_config_template: powershell.config.json.j2
powershell_transcription_outputdir: /var/log/powershell/transcription
powershell_executionpolicy: RemoteSigned
powershell_enablescripts: true
powershell_enablemodule_logging: true
powershell_module_names:
  - '*'
  - PSReadline
  - PowerShellGet
powershell_enableprotectedeventlogging: true
powershell_enabletranscripting: true

powershell_syslog_target: /var/log/powershell/powershell.log

powershell_logrotate_period: 'daily'
powershell_logrotate_rotate: 90
powershell_logrotate_compress: true
powershell_logrotate_delaycompress: true
powershell_logrotate_datext: true
powershell_logrotate_datformat: '-%Y%m%d'

Continuous integration

$ pip install molecule docker
$ molecule test
$ MOLECULE_DISTRO=ubuntu:20.04 molecule test --destroy=never

Troubleshooting & Known issues

  • ExecutionPolicy setting does not work on Linux
PS /root> Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy: Operation is not supported on this platform.

See also: PowerShell/PowerShell#7573, PowerShell/PowerShell#1998, https://learn.microsoft.com/en-us/powershell/scripting/whats-new/unix-support?view=powershell-7.2

License

BSD 2-clause

About

Set Powershell on linux, including config file and logging

License:BSD 2-Clause "Simplified" License


Languages

Language:Jinja 100.0%